@extends('layout/index' )
@section('main')
    <div class="mws-panel grid_8">
        <div class="mws-panel-header">
            <span><i class="icon-align-left"></i> 评论列表 &nbsp;&nbsp;&nbsp;&nbsp;回收站
            </span>
        </div>
        <div class="mws-panel-body no-padding">
            <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
                <form action="/Admin/comment/recycle" method="get">
                    <div class="dataTables_length" id="DataTables_Table_1_length">
                        <label>显示
                            <select aria-controls="DataTables_Table_1" size="1" name="num">
                                <option value="10" {{ (!empty($request['num'])&&$request['num'])== 5?'selected':''}}>5</option>
                                <option value="25" {{ (!empty($request['num'])&&$request['num'])==25?'selected':''}}>10</option>
                                <option value="50" {{ (!empty($request['num'])&&$request['num'])==50?'selected':''}}>50</option>
                                <option value="100" {{ (!empty($request['num'])&&$request['num'])==100?'selected':''}}>20</option>
                            </select> 条数据</label>
                    </div>
                    <div id="DataTables_Table_1_filter" class="dataTables_filter">
                        <label>搜索: <input aria-controls="DataTables_Table_1" type="text" name="search" value="{{$request['search'] or ''}}"></label>
                        <button class="btn btn-default">点击搜索</button>
                    </div>
                </form>
                <table aria-describedby="DataTables_Table_1_info" id="DataTables_Table_1" class="mws-datatable-fn mws-table dataTable">
                    <thead>
                    <tr role="row">
                        <th aria-label="Rendering engine: activate to sort column descending" aria-sort="ascending" style="width: 50px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting_asc">编号</th>
                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 150px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">商品ID:商品名</th>
                        <th aria-label="Platform(s): activate to sort column ascending" style="width: 150px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">用户ID:用户名</th>
                        <th aria-label="Engine version: activate to sort column ascending" style="width: 130px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">商品图片</th>
                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 118px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">评论内容</th>
                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 118px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">回复内容</th>
                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 118px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">评论时间</th>
                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 80px;" colspan="1" rowspan="1" aria-controls="DataTables_Table_1" tabindex="0" role="columnheader" class="sorting">操作</th>
                    </tr>
                      <tbody aria-relevant="all" aria-live="polite" role="alert">
                    @foreach($res as $k=>$v)
                            <tr class="{{$k%2==0?'odd':'even'}}">
                                <td class="  sorting_1">{{$v->id}}</td>
                                <td class=" ">{{$v->gid}}: {{$v->goodsname}}</td>
                                <td class=" ">{{$v->gid}}</td>
                                <td class=" "><img src="{{$v->goodspic}}" alt="" width="60px" height="60px"></td>
                                <td class=" ">{{$v->content}}</td>
                                <td class=" ">{{$v->reply}}</td>
                                <td class=" ">{{ $v->posttime }}</td>
                                <td class=" " ><a href="javascript:;" onclick="return Enable({{ $v->id }})">启用</a></td>
                            </tr>
                    @endforeach
                    </tbody>
                </table>

                <div id="page" class="dataTables_paginate paging_full_numbers">
                      {!! $res->appends($request)->render() !!}
                </div>
            </div>
        </div>
    </div>

   

@endsection

@section('js')

<script type="text/javascript">
//单击启用
 function Enable(id){

    if(confirm("确定要启用吗?")) {
        //发送ajax
        $.get("/Admin/comment/enable",{id:id},function(data) {

             if(data == "yes") {
                 alert("启用成功");
                 location.href="/Admin/comment/index";
             } else {
                alert("启用失败");
            }
        })
     }
  }
</script>

@endsection